package models;

import java.io.Serializable;

import javax.persistence.Embeddable;
import javax.persistence.ManyToOne;

import play.db.jpa.GenericModel;

@Embeddable
public class DeliverySpotValuesId implements Serializable {
	@ManyToOne(optional=false)
	private  DeliverySpot deliverySpot;
	@ManyToOne(optional=false)
	private  SpotConfigurationAttribute attribute;
	
	public DeliverySpot getDeliverySpot() {
		return deliverySpot;
	}
	
	public void setDeliverySpot(DeliverySpot deliverySpot) {
		this.deliverySpot = deliverySpot;
	}
	
	public SpotConfigurationAttribute getAttribute() {
		return attribute;
	}
	
	public void setAttribute(SpotConfigurationAttribute attribute) {
		this.attribute = attribute;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((attribute == null) ? 0 : attribute.hashCode());
		result = prime * result
				+ ((deliverySpot == null) ? 0 : deliverySpot.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		DeliverySpotValuesId other = (DeliverySpotValuesId) obj;
		if (attribute == null) {
			if (other.attribute != null)
				return false;
		} else if (!attribute.equals(other.attribute))
			return false;
		if (deliverySpot == null) {
			if (other.deliverySpot != null)
				return false;
		} else if (!deliverySpot.equals(other.deliverySpot))
			return false;
		return true;
	}
}
